/**
 * File: Topping.java
 * Author: Eliana Feasley and Mark pallone
 * Emails: elf4@umbc.edu , markpa1@umbc.edu
 * Date: Jun 19, 2011
 * 
 * Description: Any topping for a tasty treat. 
 */
package model;

/**
 * @author mark
 *
 */
public class Topping {
	private String type;
	private double price;
	
	/**
	 * 
	 * Topping - Create an object.
	 * Preconditions: price must be zero or positive
	 * Postconditions: a Topping will be created
	 * @param type the type of the topping "Maraschino Cherry", "Hot Fudge"
	 * @param price the cost of the topping 
	 */
	public Topping(String type, double price) {
		this.setType(type);
		this.setPrice(price);
	}
	
	/**
	 * toString - get a String representation of this object
	 * preconditions: none
	 * postconditions: none
	 * @return String representation of this object
	 */
	public String toString() {
		return type;
	}

	/**
	 * setType - set type
	 * Preconditions: none
	 * Postconditions: the type will be returned
	 * @param type the type to set
	 */
	public void setType(String type) {
		this.type = type;
	}

	/**
	 * getType - get the type
	 * Preconditions: none
	 * Postconditions: the type will be returned
	 * @return the type
	 */
	public String getType() {
		return type;
	}

	/**
	 * setPrice - set price
	 * Preconditions: price must be zero or positive
	 * Postconditions: the price will be returned
	 * @param price the price to set
	 */
	public void setPrice(double price) {
		if (price >= 0) {
			this.price = price;
		} else {
			this.price = 0;
		}
	}

	/**
	 * getPrice - get the price
	 * Preconditions: none
	 * Postconditions: the price will be returned
	 * @return the price
	 */
	public double getPrice() {
		return price;
	}
	
	
}
